﻿/********************************************************************************
 * Developed by Phil Tyler (http://www.laidbackcoder.co.uk)
 * 
 * Cryptosolic is Licensed under the GNU Lesser General Public License (LGPL)
 * http://cryptosolic.codeplex.com/license
 * *****************************************************************************/
using System.Security.Cryptography;

namespace Cryptosolic.Security
{
    /// <summary>
    /// Class used to Generate Psudo-Random Data
    /// </summary>
    public static class RandomNumberGenerator
    {
        /// <summary>
        /// Generate Random Bytes
        /// 
        /// (http://stackoverflow.com/questions/22591882/which-psudo-random-number-generation-algorithm-does-rngcryptoserviceprovider-use)
        /// </summary>
        /// <param name="OutputSize">Number of Bytes to be Generated</param>
        /// <returns>Byte[] Full of Psudo-Random Data</returns>
        public static byte[] GenerateRandomData(int OutputSize)
        {
            byte[] data = new byte[OutputSize];
            
            new RNGCryptoServiceProvider().GetBytes(data);
            
            return data;
        }
    }
}
